function verifyAddIntent_UId() {
    const tmp = $("#userId").val();
    if (tmp == "") {
        document.getElementById("UId").innerHTML="<font color='red'>下单ID不能为空</font>";
        document.getElementById("submit").disabled = true;
        return false;
    }else if(!(/(^[1-9]\d*$)/.test(tmp))){
        document.getElementById("UId").innerHTML="<font color='red'>必须输入正数</font>";
        document.getElementById("submit").disabled = true;
        return false;
    } else {
        // 这里应该不做反应，或是与if进行反向操作
        document.getElementById("UId").innerHTML="";
        document.getElementById("submit").disabled = false;
    }
    console.log(tmp)

    $.ajax({
        type: "get",
        data:{
            userId:$("#userId").val()
        },
        url:"/verifyAddIntent_UId",
        async:false,
        success(data){
            console.log(data)
            if (data == false){
                document.getElementById("UId").innerHTML="<font color='red'>ID不存在</font>";
                document.getElementById("submit").disabled = true;
            }
        },
        error(){
            // alert("ajax配置有错，请检查url与type是否正确");
            alert("error");
            console.log(this.data)
        }
    });
}

function verifyAddIntent_Phone(){
    const tmp = $("#phone").val();
    if(tmp==""){
        document.getElementById("ph").innerHTML="<font color='red'>电话号码不能为空</font>";
        document.getElementById("submit").disabled = true;
        return false;
    }
    else if((!(/^1(?:3\d|4[4-9]|5[0-35-9]|6[67]|7[013-8]|8\d|9\d)\d{8}$/.test(tmp)))){
        document.getElementById("ph").innerHTML="<font color='red'>电话号码不合规矩</font>";
        document.getElementById("submit").disabled = true;
        return false;
    }else{
        document.getElementById("ph").innerHTML="<font color='red'></font>";
        document.getElementById("submit").disabled = false;
        return true;
    }
}

function verifyTypeName(){
    const tmp = $("#typeName").val();
    if (tmp == "") {
        document.getElementById("tn").innerHTML="<font color='red'>分类名不能为空</font>";
        document.getElementById("submit").disabled = true;
        return false;
    } else {
        // 这里应该不做反应，或是与if进行反向操作
        document.getElementById("tn").innerHTML="";
        document.getElementById("submit").disabled = false;
    }
    console.log(tmp)
    $.ajax({
        type: "get",
        url:"/verifyTypeName",
        async:false,
        data:{
            typeName:$("#typeName").val()
        },
        success(data){
            console.log(data)
            if (data == false){
                document.getElementById("tn").innerHTML="<font color='red'>分类名已存在</font>";
                document.getElementById("submit").disabled = true;
            }
        },
        error(){
            console.log("error")
            // alert("ajax配置有错，请检查url与type是否正确");
        }
    });
}

function verifyRoleName(){
    const tmp = $("#name").val();
    if (tmp == "") {
        document.getElementById("rl").innerHTML="<font color='red'>角色名不能为空</font>";
        document.getElementById("submit").disabled = true;
        return false;
    } else {
        // 这里应该不做反应，或是与if进行反向操作
        document.getElementById("rl").innerHTML="";
        document.getElementById("submit").disabled = false;
    }
    console.log(tmp)
    $.ajax({
        type: "get",
        url:"/verifyRoleName",
        async:false,
        data:{
            name:$("#name").val()
        },
        success(data){
            console.log(data)
            if (data == false){
                document.getElementById("rl").innerHTML="<font color='red'>角色名已存在</font>";
                document.getElementById("submit").disabled = true;
            }
        },
        error(){
            console.log("error")
            // alert("ajax配置有错，请检查url与type是否正确");
        }
    });
}